import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  base: './',
  plugins: [vue()],
  resolve: {
    alias: {
      '@': resolve(__dirname, './src'),
      'vue': 'vue/dist/vue.esm-bundler.js'
    }
  },
  server: {
    host: true,
    open: true,
      proxy: {
        // https://cn.vitejs.dev/config/#server-proxy
        '/dev-api': {
          // 后端地址
          target: 'https://api.biblecluble.com/bibleApi/front',
          // target: 'http://192.168.0.70:8085/gamefront',
          changeOrigin: true,
          // 将/dev-api路径去掉
          rewrite: (p) => p.replace(/^\/dev-api/, ''),
        }
      },
  },
})
